package com.sail.www.client.ui;

import com.google.gwt.user.client.ui.HasWidgets;
import com.sail.www.client.component.Component;
import com.sail.www.client.component.HomePageComponent;
import com.sail.www.client.util.PagePath;

public class Page {

	private String path;
	private HasWidgets container;
	private Component component;

	public Page(String path, HasWidgets hasWidgets) {
		this.path = path;
		this.container = hasWidgets;
	}

	public void go() {
		switch (PagePath.from(path)) {
		case HomePage:
			component = new HomePageComponent(new HomePageView(), this);
			break;
		default:
			break;
		}
		
		component.go();
	}

	public void show() {
		container.add(component.getView());
	}
}